﻿<%@ Page Title="" Language="C#" MasterPageFile="~/main2.master" AutoEventWireup="true" CodeFile="detail.aspx.cs" Inherits="detail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="css/detail.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="js/detail.js" type="text/javascript"></script>
    <script type="text/javascript">

        //回复
        function doReply(t) {
            var td = document.getElementById(t.id + "td");
            td.style.display = "block";
            var mlid = "<%=model[0].LId %>";
            if (document.getElementById(t.id + "txta") == null) {
                var txtA = document.createElement("textarea");
                txtA.style.height = "40px";
                txtA.style.width = "300px";
                txtA.style.resize = "none";
                txtA.id = t.id + "txta";
                td.appendChild(txtA);
                var a = document.createElement("a");
                a.setAttribute("href", "javascript:void(0)");
                a.innerHTML = "发表";
                a.style.marginLeft = "10px";
                a.style.color = "#7AA5B9";
                a.id = t.id + "a";
                //发表的onclick事件  发送ajax请求一般处理程序进行回复
                a.onclick = function () {
                    var mfromuid = t.id;
                    var reply = $("#" + t.id + "txta").val();

                    $.post("doReply.ashx", { "mlid": mlid, "mfromuid": mfromuid, "reply": reply }, function (data) {
                        if (data == "yes") {
                            alert("回复成功");
                            td.style.display = "none";
                            var tb = document.getElementById("tbCom");
                            var row1 = tb.insertRow(-1);
                            var col1 = row1.insertCell(-1);
                            col1.style.textAlign = "center";
                            var col2 = row1.insertCell(-1);
                            col1.innerHTML = "<%=visitor.UName %>";
                            col2.innerHTML = "回复" + t.name + ":" + $("#" + t.id + "txta").val() + "<br/><br/>" + new Date().toLocaleDateString();

                            $("#" + t.id + "txta").val("");
                        }
                        else {
                            alert("回复失败");
                        }

                    });

                };
                td.appendChild(a);
                var a2 = document.createElement("a");
                a2.setAttribute("href", "javascript:void(0)");
                a2.innerHTML = "收起";
                a2.style.marginLeft = "10px";
                a2.style.color = "#7AA5B9";
                a2.id = t.id + "a2";
                a2.onclick = function () {
                    td.style.display = "none";
                    $("#" + t.id + "txta").val("");
                };
                td.appendChild(a2);
            }
            //文本域聚焦（获得焦点）
            $("#" + t.id + "txta").focus();
        }
    
    //留言
        $(function () {
            $("#aMessage").click(function () {
                var message = $("#txtaCom").val();
                var MLId = "<%=model[0].LId %>";
                $.post("doMessage.ashx", { "message": message, "MLId": MLId }, function (data) {
                    if (data == "yes") {
                        alert("留言成功");

                        //var tb = $("#tbMessage")[0]; //从jquery对象转换成js的dom对象
                        var tb = document.getElementById("tbCom");
                        var row1 = tb.insertRow(-1);
                        var col1 = row1.insertCell(-1);
                        col1.style.textAlign = "center";
                        var col2 = row1.insertCell(-1);
                        col1.innerHTML = "<%=visitor.UName %>";
                        col2.innerHTML = $("#txtaCom").val() + "<br/><br/>" + new Date().toLocaleDateString();

                        $("#txtaCom").val("");

                    } else {
                        alert("留言失败，请您重新留言");
                    }
                });
            });
        });


    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  
  <%=sb2.ToString() %>
  
  <center>
  <table id="tbInfo" width="480px" style="text-align:center">
    <asp:Repeater ID="rpDetail" EnableViewState="true" runat="server">
    <ItemTemplate>
                   <th>
                   <tr style="background-color:#CAE8EA"><td width="100px">信息类型</td><td><%#Eval("LostProperty") %></td></tr>
                   </th>
                   <tr style="background-color:#fff"><td><%=sb.ToString() %></td><td><%#Eval("User.UName") %></td></tr>                   
                   <tr style="background-color:#f5fafa"><td>物品</td><td><%#Eval("GoodsName") %></td></tr>
                   <tr style="background-color:#fff"><td>物品特征</td><td><%#Eval("Feature") %></td></tr>
                   <tr style="background-color:#f5fafa"><td>地点</td><td><%#Eval("Address") %></td></tr>
                   <tr style="background-color:#fff"><td>时间</td><td><%#Eval("Time","{0:yyyy-MM-dd}") %></td></tr>
                   <tr style="background-color:#f5fafa"><td>图片</td><td><image width="200px" height="180px" src='imgpublish/<%#Eval("Image") %>'></image></td></tr>
                   
                   <tr style="background-color:#fff"><td rowspan="4">联系方式</td>
                   <td>
                   <tr style="background-color:#fff"><td>电话:<%#Eval("User.Phone") %></td></tr>
                   <tr style="background-color:#fff"><td>Email:<%#Eval("User.Email")%></td></tr>
                   <tr style="background-color:#fff"><td>QQ:<%#Eval("User.QQ")%></td></tr>
                   </td>
                   </tr>

                   <tr style="background-color:#f5fafa">
                   <td align="center" style="border-right:none">分享到： </td>
                   <td align="right" style="border-left:none">                
                       <!-- JiaThis Button BEGIN -->
                        <div class="jiathis_style" style="width:160px">
	                        <a class="jiathis_button_qzone"></a>
	                        <a class="jiathis_button_tsina"></a>
	                        <a class="jiathis_button_tqq"></a>
	                        <a class="jiathis_button_renren"></a>
	                        <a class="jiathis_button_kaixin001"></a>
	                        <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	                        <a class="jiathis_counter_style"></a>
                        </div>
                        <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=1347630834000941" charset="utf-8"></script>
                        <!-- JiaThis Button END -->                  
                   </td>
                   </tr>
                   <tr>
                   <td colspan="2" align="center">
                   这里可能会找到您需要的信息
                       <a style="color:#FF0aaa; text-decoration:underline" href='searchResults.aspx?keyword=<%#Eval("GoodsName") %>'><%#Eval("GoodsName")%></a>
                   </td>
                   </tr>
    </ItemTemplate>
    
    </asp:Repeater>
  </table>
  <div id="DelACom">
            <%--<a runat="server" id="delInfo" style="color:#7AA5B9" href="javascript:void(0)">删除</a>--%>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <a runat="server" id="Reply" style="color:#7AA5B9" href="javascript:void(0)" onclick="createEle()">留言</a>
            &nbsp;&nbsp;&nbsp;&nbsp;
  </div>
  <div id="comment" style="	display:none;">
      <div id="commenthead">
        
      </div>
      <div id="commentfooter">
            <div style="width:480px; height:15px"></div>
            <textarea id="txtaCom" style="border:solid 1px #C6C6C6;resize:none; height:60px"></textarea><br />
          
            <table width="420px"><tr><td align="right">
                <a id="aMessage" href="javascript:void(0)"  style="color:#7AA5B9;" >留言</a>
          </td></tr></table>
          <table  cellspacing="8px" id="tbCom" style="text-align:left;">
                

              <asp:Repeater ID="rpComment" EnableViewState="true" runat="server">
              <ItemTemplate>

                            <tr style="background-color:#f5fafa">
                                <td  style="height:40px; text-align:center; "><%#Eval("Mfromuser.UName")%></td>                                                            
                                <td><%#Eval("MContent")%><br /><br /><%#Eval("MAddTime")%>
                                <a style="color:#7AA5B9" name='<%#Eval("Mfromuser.UName") %>' id='<%#Eval("MFromUId") %>' href="javascript:void(0)" onclick='doReply(this)'>回复</a>
                                </td>
                            </tr>
                            <tr style="text-align:center;">
                                <td></td>
                                <td id='<%#Eval("MFromUId") %>td'></td>
                                
                            </tr>

              </ItemTemplate>
              <AlternatingItemTemplate>
                           <tr style="background-color:#fff;">
                                <td  style="height:40px; text-align:center; "><%#Eval("Mfromuser.UName")%></td>                                                            
                                <td><%#Eval("MContent")%><br /><br /><%#Eval("MAddTime")%>
                                <a style="color:#7AA5B9" name='<%#Eval("Mfromuser.UName") %>' id='<%#Eval("MFromUId") %><%#Eval("MAddTime") %>' href="javascript:void(0)" onclick='doReply(this)'>回复</a>
                                </td>
                            </tr>
                            <tr style="text-align:center;">
                                <td></td>
                                <td id='<%#Eval("MFromUId") %><%#Eval("MAddTime") %>td'></td>
                                
                            </tr>
              </AlternatingItemTemplate>
              </asp:Repeater>


          </table>
          <div style="width:480px; height:15px; background-color:White"></div>  
      </div>
  </div>
  </center>
</asp:Content>

